package com.example.service.listener;

import com.example.service.SendEmailService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.mail.MessagingException;
import java.util.Map;

@Component
public class MessageListener {

    @Resource
    private SendEmailService sendEmailService;

    @RabbitListener(queues = "direct_queue_ams")
    public void receive(Map<String,String> map) throws MessagingException {
        sendEmailService.sendEmailservice(map.get("content"),map.get("address"));
    }
}
